<?php



namespace App\Http\Requests\Company;




use Illuminate\Support\Facades\Auth;

class RoleRequest extends BaseRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'title' => 'required',
            'charge' => 'required',
            'thumb' => 'required',
            'expire_days' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入VIP名'),
            'thumb.required' => __('请上传封面'),
            'charge.required' => __('请输入VIP价格'),
            'expire_days.required' => __('请输入VIP有效时长'),
        ];
    }

    public function filldata()
    {
        $user= Auth::user();
        return [
            'company_id'=>$user['login_company_id'],
            'title' => $this->input('title'),
            'thumb' => $this->input('thumb'),
            'charge' => (int)$this->input('charge'),
            'expire_days' => (int)$this->input('expire_days'),
            'weight' => (int)$this->input('weight'),
            'description'=>(int)$this->input('description', 0),
            'privilege_ids' => (array)$this->input('privilegeIds', []),
            'is_forever_membership'=>(int)$this->input('is_forever_membership'),
        ];
    }
}
